import Vue from 'vue'
import store from './store'
import Router from 'vue-router'

Vue.use(Router)

// 用户登录注册
const Login = () => import('./views/user/login.vue')

// 首页
const Home = () => import('./views/home/index.vue')
const ChooseRoom = () => import('./views/home/choose-room.vue')

// 车辆
const CarRecord = () => import('./views/car-record/index.vue')
const CarRecordCar = () => import('./views/car-record/car.vue')
const CarRecordList = () => import('./views/car-record/list.vue')

const routes = [
	{
		path: '/login',
		component: Login,
		meta: {
			title: '登录'
		}
	},

	{
		path: '/',
		component: Home,
		meta: {
			title: '智慧社区'
		}
	},
	{
		path: '/choose-room',
		component: ChooseRoom,
		meta: {
			title: '切换房屋地址'
		}
	},
	{
		path: '/car-record',
		component: CarRecord,
		children: [
			{
				path: '',
				component: CarRecordCar,
				meta: {
					title: '车辆通行记录'
				}
			},
			{
				path: 'list',
				component: CarRecordList,
				meta: {
					title: '车辆通行记录'
				}
			}
		],
		meta: {
			title: '车辆通行记录'
		}
	}
]

const router = new Router({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
